package com.sspaas.message.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.sspaas.message.pojo.Message;
import com.sspaas.message.pojo.MessageResult;
import com.sspaas.message.pojo.SuperMessage;
import com.sspaas.message.service.MessageService;
import com.sspaas.message.utils.ShortMsgUtils;

/**
 * 完成短信的内部之间调用
 * 
 * @author yj
 *
 */
@Controller
public class MessageController {

	@Autowired
	private MessageService messageService;

	/**
	 * 提供内部使用的 短信第三方平台方法.
	 * 
	 * @param message
	 * @return
	 */
	@RequestMapping(value = "/sendShortMsg", method = RequestMethod.POST)
	public ResponseEntity<MessageResult> sendShortMessage(@RequestBody Message message) {
		MessageResult result = messageService.sendShortMsg(message);
		return ResponseEntity.status(HttpStatus.OK).body(result);
	}

	/**
	 * 提供 集合 允许同时发送多条短信 传递参数 短信模板 传递参数集合
	 * 
	 * @param message
	 * @return
	 */
	@RequestMapping(value = "/sendShortMsgs", method = RequestMethod.POST)
	public ResponseEntity<MessageResult> sendShortMsgList(@RequestBody SuperMessage superMessage) {
		MessageResult result = messageService.sendShortMsgList(superMessage);
		return ResponseEntity.status(HttpStatus.OK).body(result);
	}

}
